const downloadtasks = {
  state: {
    // 下载任务是否启动
    downloadTasksOn: false,
    // 下载任务集合
    downloadTasksList: [],
    // 任务详细集合
    downloadTasksDescMap: {},
    // 增加文件锁
    fileIsLocked : false
  },
  mutations: {
    SET_DOWNLOADTASKSON: (state, downloadTasksOn) => {
      state.downloadTasksOn = downloadTasksOn
    },
    SET_DOWNLOADTASKSLIST: (state, downloadTasksList) => {
      state.downloadTasksList = downloadTasksList
    },
    SET_DOWNLOADTASKSDESCMAP: (state, downloadTasksDescMap) => {
      state.downloadTasksDescMap = downloadTasksDescMap
    },
    SET_FILEISLOCKED: (state, fileIsLocked) => {
      state.fileIsLocked = fileIsLocked
    },
  },
  actions: {
    setDownloadTasksOn({ commit }, downloadTasksOn) {
      commit('SET_DOWNLOADTASKSON', downloadTasksOn)
    },
    setDownloadTasksList({ commit }, downloadTasksList) {
      commit('SET_DOWNLOADTASKSLIST', downloadTasksList)
    },
    setDownloadTasksDescMap({ commit }, downloadTasksDescMap) {
      commit('SET_DOWNLOADTASKSDESCMAP', downloadTasksDescMap)
    },
    setFileIsLocked({ commit }, fileIsLocked) {
      commit('SET_FILEISLOCKED', fileIsLocked)
    },
  }
};

export default downloadtasks
